﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AutomationTools.Procedimentos.SimulacaoUso.Aplicativo
{
    public class IniciarProcesso : IProcedimento
    {
        string exePath;
        string[] args;


        public IniciarProcesso(string exePath)
            : this(exePath, null) { }

        public IniciarProcesso(string exePath, params string[] args)
        {
            this.exePath = exePath;
            this.args = args;
        }

        public object Executar(IContexto contexto)
        {
            Process process = new Process();
            process.StartInfo = new ProcessStartInfo(exePath, string.Concat(args.Select(x => string.Format("\"{0}\" ", x))));
            process.Start();

            return contexto.Parametro;
        }

        public void ValidarEntrada(IContexto contexto)
        {
            throw new NotImplementedException();
        }
    }
}
